ccflags-y += -Wall -Wno-error=incompatible-pointer-types
ifeq ($(DAVINCI_HIAI_DKMS), y)
LOCAL_PATH := $(HIAI_DKMS_DIR)/dvpp_cmdlist
include $(LOCAL_PATH)/Makefile_dkms
else
LOCAL_PATH := $(TOP_DIR)/ace/dvpp/dvpp/dvpp_cmdlist

obj-m   += drv_dvpp_cmdlist.o

drv_dvpp_cmdlist-objs := dvpp_cmdlist_init.o \
                         decoder/dvpp_decoder.o \
                         decoder/tlv/dvpp_tlv_decoder.o \
                         decoder/vpu/dvpp_vpu_decoder.o \
                         cmdlist/dvpp_cmdlist.o \
                         cmdlist/vpc/pipeline/pipeline_module.o \
                         cmdlist/vpc/vpc_cmdlist.o \
                         cmdlist/vpc/drv/drv_vpc_comm.o \
                         reg/vpc/milan/vpc_reg.o \
                         cmdlist/jpegd/drv/drv_jpegd_comm.o \
                         cmdlist/jpegd/jpegd_cmdlist.o \
                         cmdlist/jpegd/drv/drv_jpegd.o \
                         proc/dvpp_cmdlist_proc.o \
                         context/dvpp_cmdlist_context.o \
                         base/dvpp_cmdlist_util.o \
                         cmdlist/jpegd/drv/drv_jpegd.o \
                         cmdlist/jpege/drv/drv_jpege_comm.o \
                         cmdlist/jpege/jpege_cmdlist.o \
                         cmdlist/jpege/drv/drv_jpege.o \
                         main/comm/dvpp_sqe_update_comm.o \
                         main/comm/dvpp_sqe_para_check.o \
                         memory/args_mem_pool.o \
                         memory/mem_allocater.o \
                         memory/dvpp_mem_allocater_comm.o \
                         memory/dvpp_mem_allocater_args.o \
                         fops/dvpp_cmdlist_ioctl.o \
                         cmdlist/vpc/pipeline/pipeline_top.o

ifeq ($(RUN_MODE), device)
EXTRA_CFLAGS += -DRUN_MODE_OFFLINE
drv_dvpp_cmdlist-objs += main/device/dvpp_sqe_update_device.o
drv_dvpp_cmdlist-objs += main/device/dvpp_sqe_gen.o
drv_dvpp_cmdlist-objs += memory/dvpp_mem_allocater_comm_device.o
drv_dvpp_cmdlist-objs += pipe/vpc/src/vpc_pipe_channel.o
drv_dvpp_cmdlist-objs += pipe/vpc/xauxx/format/vpc_pipe_format.o
drv_dvpp_cmdlist-objs += pipe/vpc/xauxx/format/field/gray_field.o
drv_dvpp_cmdlist-objs += pipe/vpc/xauxx/format/field/rgb_field.o
drv_dvpp_cmdlist-objs += pipe/vpc/xauxx/format/field/yuv_field.o
drv_dvpp_cmdlist-objs += pipe/vpc/xauxx/resize/vpc_pipe_resize.o
drv_dvpp_cmdlist-objs += pipe/vpc/xauxx/yuvscaler/vpc_pipe_yuvscaler.o
drv_dvpp_cmdlist-objs += pipe/vpc/xauxx/yuvscaler/coeff/yuv_scaler_para_set.o
drv_dvpp_cmdlist-objs += pipe/vpc/xauxx/csc/vpc_pipe_csc.o
drv_dvpp_cmdlist-objs += pipe/vpc/src/vpc_pipe_kernel.o
drv_dvpp_cmdlist-objs += pipe/vpc/src/mlv1r1/vpc_pipe_mlv1r1.o
drv_dvpp_cmdlist-objs += pipe/vpc/src/mlv1r3/vpc_pipe_mlv1r3.o
drv_dvpp_cmdlist-objs += pipe/vpc/src/vpc_pipe_proc.o
drv_dvpp_cmdlist-objs += pipe/vpc/ext/dvpp_vpc_pipe.o
EXTRA_CFLAGS += -I$(LOCAL_PATH)/main/device
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/util
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/xauxx/format
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/xauxx/format/field
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/xauxx/csc
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/xauxx/yuvscaler
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/xauxx/yuvscaler/coeff
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/xauxx/resize
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/inc
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/src
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/type
EXTRA_CFLAGS += -I$(LOCAL_PATH)/pipe/vpc/ext
EXTRA_CFLAGS += -I$(TOP_DIR)/ace/dvpp/inc/dvpp/vpc_pipeline
EXTRA_CFLAGS += -I$(TOP_DIR)/ace/dvpp/inc/dvpp
EXTRA_CFLAGS += -I$(TOP_DIR)/ace/dvpp/inc/external/dvpp
EXTRA_CFLAGS += -I$(TOP_DIR)/ace/media/mediabase/inc/external/mediabase
EXTRA_CFLAGS += -I$(TOP_DIR)/ace/media/mediabase/inc/mediabase/include
EXTRA_CFLAGS += -I$(TOP_DIR)/ace/media/mediabase/inc/mediabase/include/adapt
EXTRA_CFLAGS += -I$(TOP_DIR)/ace/media/mediabase/src/base/arch/hidvpp/include
endif

ifeq ($(RUN_MODE), host)
EXTRA_CFLAGS += -DRUN_MODE_ONLINE
drv_dvpp_cmdlist-objs += main/host/dvpp_sqe_update_host.o
drv_dvpp_cmdlist-objs += main/host/dvpp_sqe_update_phy.o
drv_dvpp_cmdlist-objs += main/host/mem_ctrl/dvpp_dma_mem_ctrl.o
drv_dvpp_cmdlist-objs += main/host/mem_ctrl/dvpp_svm_mem_ctrl.o
drv_dvpp_cmdlist-objs += dvpp_pcie_init.o
drv_dvpp_cmdlist-objs += memory/dvpp_mem_allocater_comm_host.o
drv_dvpp_cmdlist-objs += memory/dvpp_mem_allocater_dma.o
drv_dvpp_cmdlist-objs += memory/dma_mem_pool.o

EXTRA_CFLAGS += -I$(LOCAL_PATH)/main/host
EXTRA_CFLAGS += -I$(LOCAL_PATH)/main/host/mem_ctrl
EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/ai_sdk/arc/linux/kernel_space_open/inc
EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/ai_sdk/arc/linux/kernel_space/src/svmdrv/common
EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/ai_sdk/arc/linux/kernel_space/inc
EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/ai_sdk/arc/linux/kernel_space/src/vascend_drv/vascend_drv_stub
EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/ai_sdk/arc/linux/kernel_space/src/virtmng/vmng_host
EXTRA_CFLAGS += -I$(TOP_DIR)/ace/dvpp/inc/dvpp
endif

ifeq ($(BUILD_TYPE), Debug)
EXTRA_CFLAGS += -DBUILD_DEBUG
endif

ifeq ($(BUILD_TYPE), Release)
EXTRA_CFLAGS += -DBUILD_RELEASE
endif


EXTRA_CFLAGS += -Wno-error=incompatible-pointer-types
EXTRA_CFLAGS += -Wno-unused-parameter
EXTRA_CFLAGS += -fstack-protector-all
EXTRA_CFLAGS += -fno-common

EXTRA_CFLAGS += -fsigned-char
EXTRA_CFLAGS += -pipe
EXTRA_CFLAGS += -O2
EXTRA_CFLAGS += -Wtrampolines
EXTRA_CFLAGS += -Wswitch-default
EXTRA_CFLAGS += -Wvla
EXTRA_CFLAGS += -Wextra
EXTRA_CFLAGS += -Wformat=2
EXTRA_CFLAGS += -Wfloat-equal

EXTRA_CFLAGS += -Wshadow
EXTRA_CFLAGS += -Wunused
EXTRA_CFLAGS += -Wstrict-prototypes

EXTRA_CFLAGS += -I$(TOP_DIR)/abl/libc_sec/include \
                -I$(TOP_DIR)/drivers/ts_agent/inc \
                -I$(TOP_DIR)/inc/driver \
                -I$(TOP_DIR)/ace/dvpp/inc/dvpp/vpc_pipeline \
                -I$(TOP_DIR)/ace/dvpp/inc/dvpp \


EXTRA_CFLAGS += -I$(LOCAL_PATH)/reg/vpc/milan \
                -I$(LOCAL_PATH)/reg/jpegd/milan \
                -I$(LOCAL_PATH)/reg/jpege/milan \
                -I$(LOCAL_PATH)/cmdlist/vpc/pipeline \
                -I$(LOCAL_PATH)/main/comm \
                -I$(LOCAL_PATH)/main/inc \
                -I$(LOCAL_PATH)/decoder \
                -I$(LOCAL_PATH)/decoder/tlv \
                -I$(LOCAL_PATH)/decoder/vpu \
                -I$(LOCAL_PATH)/decoder/type \
                -I$(LOCAL_PATH)/base \
                -I$(LOCAL_PATH)/cmdlist \
                -I$(LOCAL_PATH)/cmdlist/vpc \
                -I$(LOCAL_PATH)/cmdlist/vpc/drv \
                -I$(LOCAL_PATH)/cmdlist/jpegd \
                -I$(LOCAL_PATH)/cmdlist/jpegd/drv \
                -I$(LOCAL_PATH)/cmdlist/jpege \
                -I$(LOCAL_PATH)/cmdlist/jpege/drv \
                -I$(LOCAL_PATH)/fops \
                -I$(LOCAL_PATH)/proc \
                -I$(LOCAL_PATH)/context \
                -I$(LOCAL_PATH)/memory \
                -I$(LOCAL_PATH)/vmng

ifneq ($(findstring $(PRODUCT),  ascend310B ascend310Brc as31xm1),)
drv_dvpp_cmdlist-objs += cmdlist/vpc/drv/mlv1r3/drv_vpc_mlv1r3.o

EXTRA_CFLAGS += -I$(LOCAL_PATH)/cmdlist/vpc/drv/mlv1r3
endif

ifneq ($(findstring $(PRODUCT),  ascend910B ascend920),)
drv_dvpp_cmdlist-objs += cmdlist/vpc/drv/mlv1r1/drv_vpc_mlv1r1.o
drv_dvpp_cmdlist-objs += vmng/dvpp_vcm_host.o
drv_dvpp_cmdlist-objs += vmng/dvpp_vmng.o
drv_dvpp_cmdlist-objs += main/host/dvpp_sqe_update_vir.o
drv_dvpp_cmdlist-objs += main/host/mem_ctrl/dvpp_share_mem_ctrl.o

EXTRA_CFLAGS += -I$(LOCAL_PATH)/cmdlist/vpc/drv/mlv1r1
EXTRA_CFLAGS += -DSUPPORT_VIR_MACH
endif

ifeq ($(ENABLE_ASAN),true)
    EXTRA_CFLAGS += -DCFG_ENABLE_ASAN
endif

endif
